<include file="Public:header" />
<div class="page-member subpage">
    <div class="form-header">
        <div>
            <div class="line1">
                <div class="fl"><h3>建筑物信息详情 / {$building.name}</h3></div>
                <div class="fr hidden">
                    <form class="search-form" method="post" action="">
                        <input name="field" value="{$context.field}" type="hidden" />
                        <input name="value" value="{$context.value}" type="hidden" />
                        <input name="page" value="{$context.page}" type="hidden" />
                        <input name="order_field" value="{$context.order_field}" type="hidden" />
                        <input name="order_sort" value="{$context.order_sort}" type="hidden" />
                        <input name="offset" value="{$context.offset}" type="hidden" />
                        <input name="id" value="{$context.id}" type="hidden" />
                    </form>
                </div>
            </div>
            <div class="line2">
                <!-- 编辑按钮组 -->
                <div class="fl form-btn-group btn-group-edit">
                    <in name="$x|default='02-03-04'" value="$rightsCode">
                        <button onclick="action_edit();" class="btn-save btn-highlight">编 辑</button>
                        <else />
                        <button disabled="disabled" class="btn-save btn-disable">编 辑</button>
                    </in>
                    <span>或</span>
                    <a class="linkBtn btn-abort" href="/admin/building/add">创建</a>
                </div>
                <!-- 保存按钮组 -->
                <div class="fl form-btn-group btn-group-save hidden">
                    <button onclick="action_save();" class="btn-save btn-highlight">保 存</button>
                    <span>或</span>
                    <a class="linkBtn btn-abort" onclick="action_abort();" href="javascript:void(0);">放弃</a>
                </div>
                <div class="fl form-btn-more">
                    <button class="btn-normal btn-more">
                        更多操作<i class="drop-down"></i>
                    </button>
                    <ul class="more-action hidden">
                        <in name="$x|default='02-03-04'" value="$rightsCode">
                            <li><a onclick="action_del2();" href="javascript:void(0);">删 除</a></li>
                            <li><a onclick="action_copy();" href="javascript:void(0);">复 制</a></li>
                        </in>
                    </ul>
                </div>
                <div class="fr form-search-count">
                    <span class="index">{$context.index}/{$page.total}</span>
                    <button onclick="ItemJump({$page.prev.id}, {$page.prev.offset});" class="btn-normal">上一条</button>
                    <button onclick="ItemJump({$page.next.id}, {$page.next.offset});" class="btn-normal">下一条</button>
                </div>
            </div>
        </div>
    </div>
    <div class="form-box2">
        <div>
            <form id="buildingForm" method="post" action="">
                <!--表单相关原始信息存储-->
                <input type="hidden" name="old_name" value="{$building.name}" />
                <input type="hidden" name="old_community_id" value="{$building.community_id}" />
                <input type="hidden" name="old_chanquan" value="{$building.chanquan}" />
                <input type="hidden" name="old_floors" value="{$building.floors}" />
                <input type="hidden" name="old_deadline" value="{$building.deadline}" />
                <input type="hidden" name="old_no" value="{$building.no}" />
                <input type="hidden" name="old_remarks" value="{$building.remarks}" />
                <table class="form">
                    <tr>
                        <th width="20%">建筑物名称<span class="hint">*</span></th>
                        <td width="30%" field="name">{$building.name}</td>
                        <th width="20%">小区名称<span class="hint">*</span></th>
                        <td field="community_id">{$community[$building[community_id]]}</td>
                    </tr>
                    <tr>
                        <th>编号</th>
                        <td field="no">{$building.no}</td>
                        <th>层数</th>
                        <td field="floors">{$building.floors}</td>
                    </tr>
                    <tr>
                        <th>竣工年份</th>
                        <td field="deadline">{$building.deadline}</td>
                        <th>备注</th>
                        <td field="remarks">{$building.remarks}</td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>
<div class="dialog-reqnianshen dialog hidden">
    <div class="box">
        <div class="title">
            <h4 class="fl">年审设置单对话框</h4>
            <span class="fr"><a href="#" onclick="closeDialog();">关闭</a></span>
        </div>
        <table class="form-tab" style="margin-top:50px;">
            <tr>
                <th width="120">是否需要年审：</th>
                <td>
                    <input name="req_nianshen" class="pse-radio" type="checkbox" <if condition="$building.req_nianshen eq 是">checked="checked"</if> value="是" /><label>是</label>
                    <input name="req_nianshen" class="pse-radio" type="checkbox" <if condition="$building.req_nianshen eq 否">checked="checked"</if> value="否" /><label>否</label>
                    <label style="margin-left:10px;color:red;">*必填项</label>
                </td>
            </tr>
            <tr>
                <td colspan="2" style="text-align: center;line-height:80px;">
                    <button class="btn btn-highlight" onclick="action_setNS();">提交</button>
                    <span>或</span>
                    <a href="#" onclick="closeDialog();" class="linkBtn">放弃</a>
                </td>
            </tr>
        </table>
    </div>
</div>
<script>
    function action_setNS(){
        var dataId = $("input[name=id]").val();
        var state = fn_GetRadioValue('req_nianshen');
        $.ajax({
            url: '/admin/building/ajax_UpdateNS',
            dataType: 'json',
            data: {id:dataId, state:state},
            type: 'post',
            success: function(res){
                if(res.status){
                    alert("操作成功");
                    location.reload();
                }else{
                    alert(res.info);
                }
            }
        });
    }
    /**
     * 全局变量 fields  // todo
     */
    var fields = new Array("name", "no", "community_id", "chanquan", "floors", "deadline", "remarks");
    var options = {$options};
</script>
<script src="__JS__/building.js" type="text/javascript" ></script>
<include file="Public:footer" />
